function object(o) {
	function F() {}
	F.prototype = o;
	return new F();
}

S.last = function (array) {
	return array[array.lenght - 1];
}

function S(arg) {
	
	for (var i = 0; i < S.hexaGramas.length; i ++) {
		
		var hexaGrama = S.hexaGramas[i];
		
		var onTop = hexaGrama.onTop(); // Which layer is on top?
		
		/* Arguments may vary. Path may be one case, another may be the svg tag, et cetera. */
		if (arg.tagName == "path") {
		
			/* This core function is for something really important: matching the selected G with its own Hexa Object */
			// Its possible than the path is an: opaque layer, an hexa or an auxiliary hexa. We switch for performance
			switch (arg.getAttributeNS("http://www.sumacero.com.ar/2008/hexa", "type")) {
				case "hexa":
					for (var j = 0; j < onTop.hexas.length; j++ ) {
						if (onTop.hexas[j].path == arg) {
							return onTop.hexas[j];
						}
					}
					break;
				case "auxHexa":
					for (var j = 0; j < onTop.auxHexas.length; j ++) {
						if (onTop.auxHexas[j].path == arg) {
							return onTop.auxHexas[j];
						}
					}
				case "signalHexa":
					return onTop.signalHexa;
				case "opaqueLayer":
					return onTop;
			}
			
			return false;
		}
		
	}
}

S.svg = function (tagName) {
	return document.createElementNS("http://www.w3.org/2000/svg", tagName);
}
S.el = function(el) {
	return document.getElementById(el);
}

S.hexaGramas = new Array();
